﻿using System;
using System.Collections.Generic;
using UnityEngine;
using Yoozoo.Framework.Core;

namespace Gameplay.PVE.Survivor
{
    public abstract class BattleSingleton<T> where T : class, new()
    {
        protected static T p_instance;

        public static T Instance
        {
            get
            {
                if (p_instance != null)
                {
                    return p_instance;
                }

                p_instance = Activator.CreateInstance<T>();
                return p_instance;
            }
        }
        public virtual void Update() { }
        public virtual void LateUpdate() { }
        public virtual void OnGizmos() { }
        public virtual void OnGUI() { }
        public virtual void Initialize() { }
        public virtual void Dispose()
        {
            if (p_instance != null)
            {
                p_instance = null;
            }
        }
    }
}
